home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / qlib54.zip / COMPLEX.DOC next >
Text File  |  1991-11-29  |  4KB  |  131 lines

  1.  
  2.  ************************* COMPLEX DATA TYPE *******************************
  3.  
  4.  QLIB's COMPLEX data type is modeled after the COMPLEX data type in
  5.  PC FORTRAN compilers.  COMPLEX data is 8 bytes long, and consists of
  6.  paired SINGLE values.  The low 4 bytes represent the real part of the
  7.  complex value, and the high 4 bytes represent the imaginary part of the
  8.  number.  For allocating arrays, copying values or several other operations,
  9.  you may use BASIC and you should treat COMPLEX data as though it were
  10.  DOUBLE.  For calculation or data type conversion, use QLIB.  QLIB's
  11.  COMPLEX subroutines use the 80x87 if present, or use BASIC's 8087 emulator
  12.  otherwise.  As I have done limited testing with non-8087 equipped computers,
  13.  I suggest that you save your work before running any COMPLEX subroutines
  14.  from within the QuickBASIC enviornment.  Where 80x87 emulation is
  15.  indicated, I have had no problems (except for speed!!) running stand-alone
  16.  .EXE programs on computers without a math coprocessor.
  17.  
  18.  
  19.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  20.  
  21.  Subroutine: CPX2Real(cpx#, r!, i!)
  22.  Object file:  complex.obj
  23.  
  24.  80x87 not required
  25.  
  26.  CPX2Real splits a COMPLEX value into its real and imaginary components.
  27.  Note that the components are 4-byte SINGLE data, while the complex value
  28.  is 8 bytes long.
  29.  
  30.  Example:
  31.  REM cpx# is a complex value computed by QLIB earlier in the program
  32.      CALL CPX2Real(cpx#, r!, i!)
  33.      PRINT "The real part of cpx# is ", r!
  34.      PRINT "The imaginary part of cpx# is ", i!
  35.  
  36.  
  37.  
  38.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  39.  
  40.  Function:    c3# = CPXAdd#(c0#, c1#)
  41.  Object file: complex.obj
  42.  
  43.  80x87 not required; uses BASIC's emulator
  44.  
  45.  CPXAdd add two complex numbers.  c0# and c1# must be valid COMPLEX values.
  46.  
  47.  Example:
  48.   REM $INCLUDE: 'qlib.bi'
  49.        .
  50.        .
  51.        .
  52.   REM  the values of c0# and c1# were established earlier in the program
  53.   c2# = CPXAdd(c0#, c1#)
  54.  
  55.  
  56.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  57.  
  58.  Function:    c2# = CPXDiv(c0#, c1#)
  59.  Object file: complex.obj
  60.  
  61.  80x87 not required; uses BASIC's emulator
  62.  
  63.  CPXDiv divides c0# by c1#, returning the result in c2#.  c0# and c1#
  64.  must be valid COMPLEX numbers.
  65.  
  66.  Example:
  67.   REM $INCLUDE: 'qlib.bi'
  68.        .
  69.        .
  70.        .
  71.   REM  the values of c0# and c1# were established earlier in the program
  72.   c2# = CPXDiv(c0#, c1#)
  73.  
  74.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  75.  
  76.  Function:    c2# = CPXMul(c0#, c1#)
  77.  Object file: complex.obj
  78.  
  79.  80x87 not required; uses BASIC's emulator
  80.  
  81.  CPXMul multiplies c0# and c1#, returning the product in c2#.  c0# and c1#
  82.  must be valid COMPLEX numbers.
  83.  
  84.  Example:
  85.   REM $INCLUDE: 'qlib.bi'
  86.        .
  87.        .
  88.        .
  89.   REM  the values of c0# and c1# were established earlier in the program
  90.   c2# = CPXMul(c0#, c1#)
  91.  
  92.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  93.  
  94.  Function:    c1# = CPXNeg(c0#)
  95.  Function:    c1# = CPXNegI(c0#)
  96.  Function:    c1# = CPXNegR(c0#)
  97.  Object file: complex.obj
  98.  
  99.  80x87 not required
  100.  
  101.  CPXNeg changes the sign of c0#'s real and imaginary parts.  CPXNegI
  102.  changes the sign of only the imaginary part of c0#, and CPXNegR changes
  103.  the sign of only the real part of c0#.  In all cases, c0# is unchanged
  104.  and the result is returned in c1#.
  105.  
  106.  Example:
  107.   REM $INCLUDE: 'qlib.bi'
  108.        .
  109.        .
  110.        .
  111.   c1# = CPXNeg(c0#)
  112.  
  113.  
  114.  
  115.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  116.  
  117.  Function:    cpx# = Real2CPX(r!, i!)
  118.  Object file: complex.obj
  119.  
  120.  80x87 not required
  121.  
  122.  Real2CPX forms a COMPLEX value from the component real and imaginary
  123.  parts.  Note that r! and i! are 4-byte SINGLE values, and cpx# is 8
  124.  bytes long.
  125.  
  126.  Example:
  127.    REM $INCLUDE: 'qlib.ib'       ' has Real2CPX function declaration
  128.    r! = 3.678!: i! = -.0987      ' the number 3.678-.0987i
  129.    cpx# = Real2CPX(r!, i!)
  130.  
  131.